From: Florian Müllner Date: Wed, 9 Feb 2022 19:23:30 +0000 (+0100) Subject: status/location: Track enabled state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~530^2^2~71 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=78c7d5ba0c608ca4586416c861619cd8b6bb61c8;p=gnome-shell.git status/location: Track enabled state More fallout from commit e3a1d84992: We are tracking the agent's :max-accuracy-level property that we don't use, but not :enabled. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5043 Part-of: --- diff --git a/js/ui/status/location.js b/js/ui/status/location.js index 547c8347a..f4b425c02 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -238,8 +238,10 @@ class Indicator extends PanelMenu.SystemIndicator { this.menu.addMenuItem(this._item); - this._inUseId = this._agent.connect('notify::in-use', this._updateMenuLabels.bind(this)); - this._maxAccuracyId = this._agent.connect('notify::max-accuracy-level', this._updateMenuLabels.bind(this)); + this._agentSignals = [ + this._agent.connect('notify::enabled', () => this._sync()), + this._agent.connect('notify::in-use', () => this._sync()), + ]; this.connect('destroy', this._onDestroy.bind(this)); @@ -248,8 +250,8 @@ class Indicator extends PanelMenu.SystemIndicator { } _onDestroy() { - this._agent.disconnect(this._inUseId); - this._agent.disconnect(this._maxAccuracyId); + this._agentSignals.forEach(id => this._agent.disconnect(id)); + this._agentSignals = []; } _onSessionUpdated() { @@ -257,7 +259,7 @@ class Indicator extends PanelMenu.SystemIndicator { this.menu.setSensitive(sensitive); } - _updateMenuLabels() { + _sync() { if (this._agent.enabled) { this._item.label.text = this._indicator.visible ? _('Location In Use')